package com.javarcore;

import javax.swing.*;

public class MyArray1 {
	int n = 5;
	int[] a;

	void Input() {
		a = new int[n];
		int i = 0;
		while (i < n) {
			String S = JOptionPane.showInputDialog(null, "Input element: " + i,
					"0");
			a[i] = Integer.parseInt(S);
			i++;
		}
	}
	
	void Output()	{
		String S = "";
		int i = 0;
		while(i<n)	{
			S += i<n -1?a[i]+", " : a[i];
			i++;
		}
		JOptionPane.showMessageDialog(null, "Output array: " + S);
	}
	public static void main(String[] args)	{
		MyArray1 myArray1 = new MyArray1();
		myArray1.Input();
		myArray1.Output();
	}
}
